home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Programming / AmigaE / Src / Tools / EasyGUI / Examples / testaw.e < prev    next >
Encoding:
Text File  |  1997-06-09  |  1.6 KB  |  60 lines

  1. -> testaw.e - shows use of AppWindow handling and changing GUIs
  2. MODULE 'tools/easygui',
  3.        'workbench/startup', 'workbench/workbench'
  4.  
  5. CONST MAXLEN=20
  6.  
  7. DEF current=0, gui:PTR TO LONG
  8.  
  9. PROC main()
  10.   DEF s[MAXLEN]:STRING
  11.   -> Have a list of three different GUIs
  12.   gui:=[
  13.          [LISTV,{ignore},'Drop Icons on Me!',15,7,NIL,0,1,0,0,0,{gadappw}],
  14.          [ROWS,[STR,{ignore},'Drop Icons on Me:',s,MAXLEN,5,0,0,0,{gadappw}],
  15.                [SPACEV],[BUTTON,{ignore},'But Not on Me']],
  16.          [ROWS,[BUTTON,{ignore},'Drop Icons on Me:',0,0,{gadappw}],
  17.                [SPACEV],[STR,{ignore},'Not on Me:',s,MAXLEN,5]]
  18.        ]
  19.   easyguiA('Test App Window', gui[current],
  20.           [EG_AWPROC,{winappw}, NIL])
  21. ENDPROC
  22.  
  23. -> Ignore button presses etc.
  24. PROC ignore(info,num) IS EMPTY
  25.  
  26. -> Show next GUI in list
  27. PROC nextgui(gh)
  28.   current++
  29.   IF current>=ListLen(gui) THEN current:=0
  30.   changegui(gh, gui[current])
  31. ENDPROC
  32.  
  33. -> Default (window) App message handler
  34. PROC winappw(info,awmsg)
  35.   PrintF('You missed the gadget... try again!\n')
  36. ENDPROC
  37.  
  38. -> App message handler for a gadget
  39. PROC gadappw(info,awmsg)
  40.   PrintF('You hit the gadget!  ')
  41.   showappmsg(awmsg)
  42.   nextgui(info)
  43. ENDPROC
  44.  
  45. CONST NAMELEN=256
  46.  
  47. -> Show the contents of the App message
  48. PROC showappmsg(amsg:PTR TO appmessage)
  49.   DEF i, args:PTR TO wbarg, name[NAMELEN]:ARRAY
  50.   PrintF('Hit at (\d,\d)\n', amsg.mousex, amsg.mousey)
  51.   args:=amsg.arglist
  52.   FOR i:=1 TO amsg.numargs
  53.     NameFromLock(args.lock,name,NAMELEN)
  54.     PrintF('   arg(\d): Name="\s", Lock=$\h ("\s")\n',
  55.            i, args.name, args.lock, name)
  56.     args++
  57.   ENDFOR
  58.   PrintF('\n')
  59. ENDPROC
  60.